//Define button-press pin (active low)
#define BUTTON_PRESS_PIN	portb.2

//Define pins connected to grey-code dial.  Must be on portb and affect RBINT
#define GREY_PIN1		4
#define GREY_PIN2		5

//The following must be defined externally
extern void show_menu(void);			//Function to display the current menu info
extern void set_menu_state(void);		//Function to change menu state

#define GREY1							//Define the type of grey switch
////////////////////////////////////////////////////////////////////////////////

extern unsigned char gm_ctl_flags = 0;
extern unsigned char gm_menu_lvl = 0;
extern unsigned short gm_menu_sel = 0;
extern unsigned short gm_max_count;
extern unsigned char gm_step;

//user input control flags (ctl_flags)
#define BUTTON_DOWN		0
#define BUTTON_DEBOUNCE		1
#define RESET_COUNTDOWN		2
#define IN_MENU			3	//Menu is active
#define GREY			5	//An interrupt generaterd a pending grey-code state change
#define CLOCKWISE		6
#define GREY_HI			7

#define	in_menu() test_bit(gm_ctl_flags, IN_MENU)
void init_menu(void);			//Initialize all variables;
void check_grey_int(void);		//check whether knob turned (call from interrupt handler)
void menu_callback(void);	//check for menu timeout (call from interrupt handler)
void menu_update_1sec(void);
void menu_update_1min(void);
void menu_loop(void);			//check for any menu actions

#define MENU_RESET_CALLBACK
void menu_reset();
#define MENU_1MIN_CALLBACK
void menu_1min();
#define MENU_1SEC_CALLBACK
void menu_1sec();
